#include <iostream>
#include "Acceptor.h"
#include "ChannelMap.h"
#include "Buffer.h"

#include "Channel.h"
#include "EventDispatcher.h"
#include "EventLoop.h"
#include "EpollDispatcherData.h"
#include "ThreadPool.h"

#include "TcpConnection.h"

using namespace std;

void print(void *d) {
	cout << *((char *)d) << endl;
}

int main() {
	
	// Acceptor acceptor = Acceptor(15555);

	// cout << acceptor.listen_fd << " " << acceptor.listen_port << endl;

	// cout << acceptor.acc_test() << endl

	// ChannelMap map = ChannelMap();

	// map.makeSpace(12, 4);

	// cout << map.nentries_ << endl;

	// cout << 1111 << endl;

	// Buffer buff = Buffer();

	// cout << buff.getWriteableSize() << endl;

	// cout << buff.doAppendChar('c') << endl;

	// cout << buff.getWriteableSize() << endl;

	// cout << buff.doAppendStr("string") << endl;

	// cout << buff.getWriteableSize() << endl;

	EventLoop loop = EventLoop();
	EventDispatcher dispatch = EventDispatcher();
	EpollDispatcherData data = EpollDispatcherData();

	cout << "The quit is " << loop.quit_ << endl;

	cout << "The ThreadName is "  << loop.threadName_ << endl;
	// cout << data.efd << endl;

	char ch = '3';
	void *d = &ch;

	Channel channel = Channel(1, 2, NULL);
	channel.setEventReadCallBack(print);
	channel.eventReadCallBack(channel.data);

	ThreadPool pool = ThreadPool(&loop, 0);


	if (pool.eventLoopThreads_ == NULL) {
		cout << "Single Thread"  << endl;
	}

	TcpConnection conn = TcpConnection(0, NULL);

}
